{"ast":null,"code":"var _jsxFileName = \"/Users/iliyagladkov/to-do-react/src/App.js\",\n  _s = $RefreshSig$();\nimport { useState } from 'react';\nimport ToDoList from './components/ToDoList';\nimport ToDoForm from './components/UI/forms/ToDoForm';\nimport ModalTask from './components/UI/ModalTask/ModalTask';\nimport MyButtonAdd from './components/UI/MyButton/MyButtonAdd/MyButtonAdd';\nimport MyModal from './components/UI/MyModal/MyModal';\nimport './style/App.css';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nexport default function App() {\n  _s();\n  const [toDoItems, setToDoItems] = useState([\n  // FIXME: начало работы при пустом массиве возникает ошибка\n  {\n    number: 1,\n    title: 'sdkgasfgsdfg',\n    body: 'nsfugnjsdfnjnfds'\n  }, ...JSON.parse(localStorage.getItem('tasks'))]);\n  const [modalForm, setModalForm] = useState(false);\n  const [modalTask, setModalTask] = useState(false);\n  const [task, setTask] = useState({});\n  function createToDoItem(newToDoItem) {\n    setToDoItems([...toDoItems, newToDoItem]);\n    setModalForm(false);\n  }\n  function removeToDOItem(toDoItem) {\n    setToDoItems(toDoItems.filter(toDo => toDo.id !== toDoItem.id));\n  }\n  function getSourceTask(task) {\n    const getTask = {\n      number: task.number,\n      title: task.title,\n      body: task.body\n    };\n    setTask(getTask);\n  }\n  function setVisibleModal() {\n    setModalTask(true);\n  }\n\n  // TODO:\n  // click button and add task\n\n  window.localStorage.setItem('tasks', JSON.stringify(toDoItems));\n  return /*#__PURE__*/_jsxDEV(\"div\", {\n    className: \"App\",\n    children: [/*#__PURE__*/_jsxDEV(\"h1\", {\n      style: {\n        marginTop: '10px'\n      },\n      className: \"header\",\n      children: \"TO-DO LIST\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 49,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(\"hr\", {\n      style: {\n        marginTop: '15px',\n        width: '100%'\n      }\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 50,\n      columnNumber: 7\n    }, this), toDoItems.length === 0 ? /*#__PURE__*/_jsxDEV(\"h2\", {\n      style: {\n        margin: '15px',\n        color: 'red'\n      },\n      children: \"To-Do items not found...\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 53,\n      columnNumber: 9\n    }, this) : /*#__PURE__*/_jsxDEV(ToDoList, {\n      setVisibleModal: setVisibleModal,\n      getTask: getSourceTask,\n      remove: removeToDOItem,\n      toDoItems: toDoItems\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 55,\n      columnNumber: 9\n    }, this), /*#__PURE__*/_jsxDEV(MyButtonAdd, {\n      onClick: () => setModalForm(true)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 57,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(MyModal, {\n      visible: modalTask,\n      setVisible: setModalTask,\n      children: /*#__PURE__*/_jsxDEV(ModalTask, {\n        task: task\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 62,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 58,\n      columnNumber: 7\n    }, this), /*#__PURE__*/_jsxDEV(MyModal, {\n      visible: modalForm,\n      setVisible: setModalForm,\n      children: /*#__PURE__*/_jsxDEV(ToDoForm, {\n        create: createToDoItem\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 68,\n        columnNumber: 9\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 64,\n      columnNumber: 7\n    }, this)]\n  }, void 0, true, {\n    fileName: _jsxFileName,\n    lineNumber: 48,\n    columnNumber: 5\n  }, this);\n}\n_s(App, \"uzrSOccrwwBkBhfC2g9NPROzPRU=\");\n_c = App;\nvar _c;\n$RefreshReg$(_c, \"App\");","map":{"version":3,"names":["useState","ToDoList","ToDoForm","ModalTask","MyButtonAdd","MyModal","App","toDoItems","setToDoItems","number","title","body","JSON","parse","localStorage","getItem","modalForm","setModalForm","modalTask","setModalTask","task","setTask","createToDoItem","newToDoItem","removeToDOItem","toDoItem","filter","toDo","id","getSourceTask","getTask","setVisibleModal","window","setItem","stringify","marginTop","width","length","margin","color"],"sources":["/Users/iliyagladkov/to-do-react/src/App.js"],"sourcesContent":["import { useState } from 'react';\nimport ToDoList from './components/ToDoList';\nimport ToDoForm from './components/UI/forms/ToDoForm';\nimport ModalTask from './components/UI/ModalTask/ModalTask';\nimport MyButtonAdd from './components/UI/MyButton/MyButtonAdd/MyButtonAdd'\nimport MyModal from './components/UI/MyModal/MyModal';\nimport './style/App.css';\n\nexport default function App() {\n\n  const [toDoItems, setToDoItems] = useState([\n    // FIXME: начало работы при пустом массиве возникает ошибка\n    {number: 1, title: 'sdkgasfgsdfg', body: 'nsfugnjsdfnjnfds'},\n    ...JSON.parse(localStorage.getItem('tasks'))\n  ])\n  const [modalForm, setModalForm] = useState(false)\n  const [modalTask, setModalTask] = useState(false)\n  const [task, setTask] = useState({})\n\n  function createToDoItem(newToDoItem) {\n    setToDoItems([...toDoItems, newToDoItem])\n    setModalForm(false)\n  }\n\n  function removeToDOItem(toDoItem) {\n    setToDoItems(toDoItems.filter(toDo => toDo.id !== toDoItem.id))\n  }\n\n  function getSourceTask(task) {\n    const getTask = {\n      number: task.number,\n      title: task.title,\n      body: task.body\n    }\n    setTask(getTask)\n  }\n\n  function setVisibleModal() {\n    setModalTask(true)\n  }\n\n  // TODO:\n  // click button and add task\n\n  window.localStorage.setItem('tasks', JSON.stringify(toDoItems))\n\n  return (\n    <div className=\"App\">\n      <h1 style={{marginTop: '10px'}} className='header'>TO-DO LIST</h1>\n      <hr style={{marginTop: '15px', width: '100%'}}/>\n      {toDoItems.length === 0\n        ?\n        <h2 style={{margin: '15px', color: 'red'}}>To-Do items not found...</h2>\n        :\n        <ToDoList setVisibleModal={setVisibleModal} getTask={getSourceTask} remove={removeToDOItem} toDoItems={toDoItems}></ToDoList>\n      }\n      <MyButtonAdd onClick={() => setModalForm(true)}/>\n      <MyModal\n        visible={modalTask}\n        setVisible={setModalTask}\n      >\n        <ModalTask task={task}/>\n      </MyModal>\n      <MyModal\n        visible={modalForm}\n        setVisible={setModalForm}\n      >\n        <ToDoForm create={createToDoItem}/>\n      </MyModal>\n    </div>\n  );\n}"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,OAAOC,QAAQ,MAAM,gCAAgC;AACrD,OAAOC,SAAS,MAAM,qCAAqC;AAC3D,OAAOC,WAAW,MAAM,kDAAkD;AAC1E,OAAOC,OAAO,MAAM,iCAAiC;AACrD,OAAO,iBAAiB;AAAC;AAEzB,eAAe,SAASC,GAAG,GAAG;EAAA;EAE5B,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGR,QAAQ,CAAC;EACzC;EACA;IAACS,MAAM,EAAE,CAAC;IAAEC,KAAK,EAAE,cAAc;IAAEC,IAAI,EAAE;EAAkB,CAAC,EAC5D,GAAGC,IAAI,CAACC,KAAK,CAACC,YAAY,CAACC,OAAO,CAAC,OAAO,CAAC,CAAC,CAC7C,CAAC;EACF,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGjB,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACkB,SAAS,EAAEC,YAAY,CAAC,GAAGnB,QAAQ,CAAC,KAAK,CAAC;EACjD,MAAM,CAACoB,IAAI,EAAEC,OAAO,CAAC,GAAGrB,QAAQ,CAAC,CAAC,CAAC,CAAC;EAEpC,SAASsB,cAAc,CAACC,WAAW,EAAE;IACnCf,YAAY,CAAC,CAAC,GAAGD,SAAS,EAAEgB,WAAW,CAAC,CAAC;IACzCN,YAAY,CAAC,KAAK,CAAC;EACrB;EAEA,SAASO,cAAc,CAACC,QAAQ,EAAE;IAChCjB,YAAY,CAACD,SAAS,CAACmB,MAAM,CAACC,IAAI,IAAIA,IAAI,CAACC,EAAE,KAAKH,QAAQ,CAACG,EAAE,CAAC,CAAC;EACjE;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